#include "../../common/asr.hpp"
#include "gflags/gflags.h"
#include "../../common/logger.hpp"
DEFINE_string(app_id,"117049864","app_id");
DEFINE_string(api_key,"AKbVfwRRCvkbIprqmqdHb2LK","平台访问key");
DEFINE_string(key_secret,"wnMxL6T4ILygYyAoqK2wFuXjpJFrs7Zd","平台访问secret");
DEFINE_bool(run_mode, false, "程序运行模式:true为发布模式,false为调试模式");
DEFINE_string(log_file, "", "发布模式中,用于存放日志的文件路径");
DEFINE_int32(log_level, 0, "发布模式中,日志输出等级");
int main(int argc,char* argv[])
{
     google::ParseCommandLineFlags(&argc, &argv, true);
    init_logger(FLAGS_run_mode, FLAGS_log_file, FLAGS_log_level);
    ASRClient client(FLAGS_app_id, FLAGS_api_key, FLAGS_key_secret);
    std::string file_content;
    aip::get_file_content("test.pcm", &file_content);
    std::string res = client.recognize(file_content);
    if(res.empty())
    {
        LOG_ERROR("语音识别失败");
    }
    else
    {
        LOG_INFO("识别结果:{}",res);
    }
    return 0;
}